﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace MyUtility
{
    public partial class P1 : PhoneApplicationPage
    {
        public P1()
        {
            InitializeComponent();
            txtRate.TextChanged += new TextChangedEventHandler(txtRate_TextChanged);
        }

        void txtRate_TextChanged(object sender, TextChangedEventArgs e)
        {
            App app = App.Current as App;
            app.centralRate = txtRate.Text;
        }

        private void bntCalculate_Click(object sender, RoutedEventArgs e)
        {
            string strRate = txtRate.Text;
            string strAmt = txtAmt.Text;
            //strRate=33.33&strAmt=12345
            string build_str = "strRate=" + strRate + "&strAmt=" + strAmt;
            // /P2.xaml?strRate=33.33&strAmt=12345
            NavigationService.Navigate(new Uri("/P2.xaml?"+build_str, UriKind.RelativeOrAbsolute));
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            txtRate.Text = (App.Current as App).centralRate;
        }
    }
}